home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 541 < prev    next >
Encoding:
Text File  |  1996-08-05  |  821 b   |  44 lines

  1. Path: iwfm05.itwol.bhp.com.au!usenet
  2. From: Sean T Dwyer <dwyer.sean.st@bhp.com.au>
  3. Newsgroups: comp.lang.c++
  4. Subject: Exceptions
  5. Date: Fri, 05 Jan 1996 11:33:46 -0800
  6. Organization: BHP-IT Wollongong
  7. Message-ID: <30ED7D1A.154F@bhp.com.au>
  8. NNTP-Posting-Host: 134.18.242.89
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=us-ascii
  11. Content-Transfer-Encoding: 7bit
  12. X-Mailer: Mozilla 2.0b3 (Win16; I)
  13.  
  14. Is it O.K to throw multiple exceptions from the main() block of a 
  15. program. I have code like this:
  16.  
  17. main()
  18. {
  19. try
  20. {
  21.     for (blah;blah;blah;)
  22.     {
  23.         if (bogus)
  24.             throw AnException();
  25.     }
  26.     for (blah;blah;blah;)
  27.     {
  28.         if (bogus2)
  29.             throw AnException();
  30.     }
  31. }
  32. catch (AnException& ex)
  33. {
  34.     blah;
  35. }
  36. }
  37.  
  38. I get an Internal error (Index out of range).
  39. If I move the for loops to a separate function, everything's cool.
  40.  
  41. Help!!!!!
  42.  
  43. Sean D.
  44.